package sparksql

import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.sql.{SQLContext, SparkSession}


/**
  *
  */
object SQLContextApp {
  def main(args: Array[String]): Unit = {
    //val path = args(0);
    val sparkConf = new SparkConf()
    sparkConf.setAppName("SQLContextApp").setMaster("local[2]"); // 在生产或测试环境AppName和Master一般使用脚本进行指定

    val sc = new SparkContext(sparkConf);
    val sqlContext = new SQLContext(sc);
    // 相关处理
    val people = sqlContext.read.format("json").load("F:\\lzc\\SparkSQL\\sparksql\\src\\main\\scala\\com\\lzc\\people.json");
    people.printSchema();
    people.show();

    // 关闭资源
    sc.stop();
  }
}
